package com.situ.onlinebookstore.back.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.situ.onlinebookstore.back.service.OrderService;
import com.situ.onlinebookstore.common.entity.Order;
import com.situ.onlinebookstore.common.mapper.OrderMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@RequiredArgsConstructor
public class OrderServiceImpl implements OrderService {
    private final OrderMapper orderMapper;
    @Override
    public Object search(Order order) {
        return orderMapper.select(order);
    }

    @Override
    public Object searchForPage(Integer page, Integer limit, Order order) {
        PageHelper.startPage(page, limit);
        List list =orderMapper.select(order);
        return new PageInfo(list);
    }

    @Override
    public int edit(Order order) {
        return orderMapper.update(order);
    }
}
